package com.chinasi.web.action.util;

import java.lang.reflect.Field;
import java.util.Map;

import com.chinasi.model.ConsumerBasic;

public class ReflectUtils {

	public static <T>T map2POJOBean(Map parameterMap,Class<T> beanClass) {
		try {
			T searchBean = beanClass.newInstance();
			for(Field field : ConsumerBasic.class.getDeclaredFields()){
					field.setAccessible(true);
					field.set(searchBean, parameterMap.get(field.getName()));
			}
			return searchBean;
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InstantiationException e1) {
			e1.printStackTrace();
		}
		return null;
	}
}
